{extend name="base/common"}

{block name="style"}
<link rel="stylesheet" href="/static/datepicker/bootstrap-datetimepicker.min.css">
<link rel="stylesheet" href="/static/iCheck/custom.css">
<link rel="stylesheet" href="/admin/css/chosen/chosen.css">
<style>
    .imggroup{
        position: relative;
    }
    .imgbox{
        height: 100px;
        width: 200px;
        margin-top: 5px;
        margin-bottom: 0;
    }
    .imgfile{
        height: 100px;
        width: 200px;
        position: absolute;
        top:0;
        opacity: 0;
    }
    .plus{
        height: 100px;
        width: 200px;
        font-size: 100px;
        line-height: 100px;
        text-align: center;
        color: rgba(204, 204, 204, 0.51);
    }
    .plus:hover{
        font-size: 150px;
    }
    .plus2{
        display: none;
    }
    .plusimg{
        display: none;
    }
    .modal-body{
        height: auto;
    }
    .pre.right{
        position: absolute;
        top:40px;
        left:425px;
    }
    .pre.right input{
        width: 150px;
    }
    .pre img,.pre label{
        display: block;
    }
    .pre label{
        margin-top: 30px;
        line-height: 30px;
    }
    .preview-content{
        width: 375px;
        height: 667px;
        overflow-y: scroll;
        box-shadow: 1px 3px 8px rgba(153, 153, 153, 0.6);
    }
</style>
{/block}

{block name="page-header"}
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-10">
        <h2>
            组织架构
        </h2>
        <ol class="breadcrumb">
            <li>
                组织架构
                </a>
            </li>
            <li class="active">
                <strong>编辑</strong>
            </li>
        </ol>
    </div>
    <div class="col-lg-2">

    </div>
</div>
{/block}

{block name="main"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content all">
                    <form id="form" class="form-horizontal" method="post">
                        <div class="form-group">
                            <div class="col-lg-1 control-label">
                                <label>内容:</label>
                            </div>
                            <div class="col-lg-11">
                                <div class=" float-e-margins">
                                    <div class="ibox-content no-padding borders">
                                        <script id="container" name="content" type="text/plain">{$msg.content || default=''}</script>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <input type="hidden" name="id" value="{$msg.id || default=''}">
                        <div class="form-group">
                            <div class="col-lg-11 col-lg-offset-1 buttons">
                                <button class="btn btn-primary submit-btn post-put" data-tab='1' type="button" target-form="form-horizontal" >发布</button>
                            </div>
                        </div>
                        <div class="selblo"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

{/block}

{block name="script"}
<script src="/static/uploadify/jquery.uploadify.min.js"></script>
<script src="/static/iCheck/icheck.min.js"></script>
<script src="/static/ueditor/ueditor.config.js"></script>
<script src="/static/ueditor/ueditor.all.min.js"></script>
<script src="/admin/js/chosen.jquery.js"></script>
<script>
    $(function(){
        //    单选按钮
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green'
        });

        highlight_subnav("{:Url('Show/index')}");

        var ue = UE.getEditor('container',{
            initialFrameHeight:500
        });
        //保存和发布
        $(".save,.post-put").off('click').on("click",function(){
            var it=$(this);
            var data = {
                id:$("input[name='id']").val(),
                content:ue.getContent(),
            };
            $.ajax({
                type:"post",
                url:$("#form").attr("action"),
                data:data,
                success:function(data){
                    if(data.code == 1){
                        updateAlert(data.msg ,'success');
                        it.prop('disabled','true');
                        it.prev().prop('disabled','true');
                        setTimeout(function(){
                            location.reload();
                            it.removeAttr('disabled');
                            it.prev().removeAttr('disabled')
                        },2000);
                    } else {
                        updateAlert(data.msg, 'error');
                        it.attr('disabled','true');
                        it.prev().prop('disabled','true');
                        setTimeout(function(){
                            it.removeAttr('disabled');
                            it.prev().removeAttr('disabled')
                        },2000);
                    }
                }
            });
        });
    })

</script>
{/block}